#include "stdafx.h"
#include "Brush.h"

CxBrush::CxBrush()
    : m_clr(CLR_INVALID)
{}

CxBrush::~CxBrush()
{}

HRESULT CxBrush::GetColor(LPCOLORREF pClr)
{
    if (!pClr)
    {
        return E_POINTER;
    }

    *pClr = m_clr & 0x00FFFFFF;

    return S_OK;
}

HRESULT CxBrush::SetColor(COLORREF clr)
{
    m_clr = clr | 0xFF000000;

    return S_OK;
}

HRESULT CxBrush::Draw(IxCanvas* pCanvas, RECT rcDest)
{
    if (!pCanvas)
    {
        return E_INVALIDARG;
    }

    pCanvas->FillSolidRect(rcDest, m_clr);

    return S_OK;
}